CC = gcc
CFLAGS = -Wall -I./Include
RELEASE_DIR = ./RELEASE
TARGET = $(RELEASE_DIR)/student_system.out

MODULE_A_OBJS = ModuleA/student.o
MODULE_B_OBJS = ModuleB/course.o
MODULE_C_OBJS = ModuleC/log.o ModuleC/data_input.o
ALL_OBJS = Main.o $(MODULE_A_OBJS) $(MODULE_B_OBJS) $(MODULE_C_OBJS)

$(RELEASE_DIR):
	mkdir -p $@

Main.o: Main.c Main.h
	$(CC) $(CFLAGS) -c $< -o $@


all: $(RELEASE_DIR)
	$(MAKE) -C ModuleA
	$(MAKE) -C ModuleB
	$(MAKE) -C ModuleC
	$(MAKE) Main.o
	$(CC) $(CFLAGS) $(ALL_OBJS) -o $(TARGET)
	@echo "编译完成：$(TARGET)"

clean:
	rm -f Main.o $(TARGET)
	$(MAKE) -C ModuleA clean
	$(MAKE) -C ModuleB clean
	$(MAKE) -C ModuleC clean
	rm -rf $(RELEASE_DIR)
